# Configure the VMware vSphere Provider
provider "vsphere" {
  user           = "administrator@hcc.com"
  password       = "xxx"
  vsphere_server = "xxx"
  allow_unverified_ssl = true
}

# =================================================================================================================================================
# 克隆Linux虚拟机
module "Linux-Servers" { # 此处改为业务组名称+业务名称，如：Prod-Infra-DNS
  source    = "./modules" # 此处根据操作系统类型更改为不同路径，linux-vm/windows-vm

  # vCenter相关配置
  dc        = "ShangHai" # 虚拟机数据中心
  vmrp      = "APP" # 虚拟机资源池
  vmfolder  = "APP" # 虚拟机文件夹

  # 虚拟机相关设置
  vmtemp    = "Centos8-Template" # 模板名称
  instances = 1 # 实例数量
  staticvmname = "test"  # 如果克隆单独一台服务器则设置该值，克隆多台且同一应用机器则使用 vmname+vmnameformat方式
  #  vmname    = "PRE-K8S-Node-" # 克隆的目标机器名称
  vmnameformat = "%01d" # 机器名尾缀号
  cpu_number = 8 # CPU 单位：Core 32 4
  ram_size = 16384 # 内存 单位：MB 65536 8192
  datastore = "SSD-RAID0" # 存储名称
  network = {
    "VM Network" = ["192.168.180.245/24"] # 网络设备，格式 "<vSwitch>" = ["<ip address1>/<prefix>", "<ip address2>/<prefix>", ...]
  }
  vmgateway = "192.168.180.1" # 网关地址


  # 通用配置
  # domain = "xxx.com" # 环境根域名
  dns_server_list = ["192.168.180.2","223.5.5.5"] # DNS地址
  # dns_suffix_list = ["xxx.com"] # DNS-search地址
  is_windows_image = false # true则执行windows自定义规范，false则执行linux自定义规范，作用为重新封装系统

  # 添加磁盘
  data_disk = {
    disk1 = {
      size_gb                   = 100, # 新磁盘大小，单位：GB
      unit_number               = 1,   # 磁盘控制器ID，0号为自带磁盘，1号或更大则为新增磁盘ID
      thin_provisioned          = true, # 开启瘦模式
      # data_disk_scsi_controller = 1, # 磁盘控制器ID，0号为自带磁盘，1号或更大则为新增磁盘ID
    }
}
}
# =================================================================================================================================================

# =================================================================================================================================================
# 克隆Windows虚拟机
#module "Windows-Server" { # 此处改为业务组名称+业务名称，如：Prod-Infra-DNS
#  source    = "./modules" # 此处根据操作系统类型更改为不同路径，linux-vm/windows-vm
#
#  # vCenter相关配置
#  dc        = "MLTY-PROD" # 数据中心
#  vmrp      = "PROD-Cluster-MGMT" # 虚拟机资源池
#  vmfolder = "基础架构团队" # 虚拟机文件夹
#
#  # 虚拟机相关设置
#  vmtemp    = "MLTY-WinServer2012-Template" # 模板名称
#  instances = 1 # 实例数量
#  staticvmname = "PROD-Windows-Test"  # 如果克隆单独一台服务器则设置该值，克隆多台且同一应用机器则使用 vmname+vmnameformat方式
#  # vmname    = "PROD-WindowsTest-" # 克隆的目标机器名称
#  # vmnameformat = "%01d" # 机器名尾缀号
#  cpu_number = 4 # CPU 单位：Core
#  ram_size = 8192 # 内存 单位：MB
#  datastore = "HF20-vm04" # 存储名称
#  network = {
#    "dv_vlan50" = ["10.0.51.221/23"]
#  }
#  vmgateway = "10.0.50.1" # 网关地址
#  dns_server_list = ["10.255.1.11"] # DNS地址
#  dns_suffix_list = ["xxx.com"] # DNS-search地址
#  is_windows_image = true # true则执行windows自定义规范，false则执行linux自定义规范，作用为重新封装系统
#
#  # Windows系统相关设置
#  orgname          = "BEAUTYFARM" # 组织名称
#  workgroup        = "BEAUTYFARM" # 工作组
#  local_adminpass  = "xxx" # 本地管理员密码
#  auto_logon = true # Windows自动登录一次
#
#  # 添加磁盘
#  data_disk = {
#    disk1 = {
#      size_gb                   = 100, # 新磁盘大小，单位：GB
#      thin_provisioned          = true, # 开启瘦模式
#      data_disk_scsi_controller = 1, # 磁盘控制器ID，0号为自带磁盘，1号或更大则为新增磁盘ID
#    }
#  }
#
#}
